<?php

namespace app\index\controller;

use think\Controller;
use think\Request;
use think\Session;
use think\Db;



// 自定义基类  判断是否登录  是否有权限访问
class Base extends Controller
{
    /**
     * 显示资源列表
     *
     * @return \think\Response
     */
    public function _initialize()
    {
        
       // 判读session是否存在
       if(empty(Session::get('userinfo'))){
           $this->error('请登录','index/Login/index');
           exit;
       }
       $userinfo =array();
       $userinfo = Session::get('userinfo');
       // var_dump($userinfo);die;
       $this->assign('userinfo',$userinfo);
    }

    public function init()
   {
       $userinfo =array();
       $userinfo = Session::get('userinfo');
       $this->assign('userinfo',$userinfo);
   }


}
